<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root 
	xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:c="http://java.sun.com/jsp/jstl/core" 
	xmlns:s="/struts-tags"
	version="2.0"
	>
    <jsp:directive.page language="java"
        contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" />
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>Edit Project</title>
		<c:url value='/scripts/projectForm.js' var='url'/>
		<script type="text/javascript" src="${url}"><!-- --></script>
	</head>
	<body>
		<s:form id="projectForm" name="projectForm" action="saveProject" method="post" validate="true" cssClass="bigform">
			<ul>
				<li class="buttonBar">
					<c:set var="buttons">
			            <s:submit key="button.save" method="save" onclick="onFormSubmit(this.form)"/>
			            
			        	<c:if test="${param.from == 'list' and not empty user.id}">
			            	<s:submit key="button.delete" method="delete" onclick="return confirmDelete('user')"/>
			        	</c:if>
			        
			            <s:submit key="button.cancel" method="cancel"/>
			        </c:set>
			        <c:out value="${buttons}" escapeXml="false"/>
				</li>
				<li style="display: none;">
					<s:hidden key="project.id"/>
				</li>
				<li>
					<s:textfield key="project.name" cssClass="text large" required="true"/>
				</li>
				<li>
					<label>Categories</label>
					<button id="newCategory">New Category</button>
					<div id="newCategoryControl">
						<div id="removeCategoryTemplate" style="display: none;">
							<c:url value="/images/delete.png" var="url"/>
							<a href="#category/remove/">
								<img alt="remove" title="remove" src="${url}"/>
							</a>
						</div>
						<c:forEach items="${project.categories}" var="category">
							<input type="text" name="category-${category.id}" value="${category.name}"/>
						</c:forEach>
					</div>
				</li>
				<li class="buttonBar">
					<c:out value="${buttons}" escapeXml="false"/>
				</li>
			</ul>
		</s:form>
	</body>
</html>
</jsp:root>